Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Adding runtime module management and updating code from source repositories #30

Merged
merged 63 commits into from
Sep 13, 2024

Conversation

davidjoy
Copy link
Contributor

@davidjoy davidjoy commented Sep 13, 2024

This is a point-in-time catchup PR from my fork. Broadly, it includes a bunch of preliminary code to load modules from Site Config into the shell and update headers to the modules' preferences.

It also includes commits from frontend-base's source repositories.

Commits from these repositories up through 9/12/2024:

  • frontend-component-header
  • frontend-component-footer
  • frontend-build

And these repositories up through 9/13/2024:

  • frontend-platform
  • frontend-plugin-framework

I'm going to be making a PR after this that shows the difficulty I had in merging in the ParagonWebpackPlugin code from frontend-build.

dcoa and others added 30 commits July 11, 2024 08:24
Backstage only accepts `.yaml` not `.yml`
* feat: expose PARAGON_VERSION as a global variable

fix: rely on paragon-theme.json from @edx/paragon

chore: clean up and add typedefs

fix: create undefined PARAGON global variable if no compatible paragon version

fix: moar better error handling

fix: updates

fix: update based on new schema for paragon-theme.json

fix: update setupTest.js

chore: clean up

chore: remove compressionplugin

chore: quality

fix: rename paragon-theme.json to theme-urls.json

chore: uninstall unused node_module

feat: add @edx/brand version and urls to PARAGON_THEME global variable

chore: update snapshot

* fix: PR feedback

fix: add comment to ParagonWebpackPlugin and update snapshots

feat: preload links from PARAGON_THEME_URLS config

fix: handle undefined this.paragonMetadata

fix: remove fallbackUrls

chore: snapshots and resolve .eslintrc error

* fix: updates

fix: typo in `alpha` CDN url within example env.config.js

Co-authored-by: Diana Olarte <dcoa@live.com>

* chore: update dependecies in example app

* chore: update add webpack-remonve-empty-scripts and parse5 dependencies

* fix: install paragon plugins and fix css compiler

* refactor: change paragon package name for openedx

* refactor: remove runtime config

* revert: example changes

* fix: add a try/catch to config loading in Paragon Plugin to avoid errors during the build

* refactor: split Paragon Plugin Utils file

* docs: update JSDoc in config/data/paragonUtils.js

Co-authored-by: Peter Kulko <93188219+PKulkoRaccoonGang@users.noreply.github.com>

* refactor: use @openedx/brand scope

this following the update here https://github.com/openedx/frontend-build/pull/490/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R158

* refactor: add utf-8 to readFileSync in paragonUtils

* perf: replace filter for reduce in getParagonThemeCss

* refactor: change entryPoints and CacheGroups variable definition.

* docs: add comment to describe the use of RemoveEmptyScriptsPlugin

* revert: restore env.development processing un webpack.dev.config.js

* refactor: remove process.env references in ParagonWebpackPlugin, no supported

* fix: use openedx scope for webpack.dev.config

* fix: allow processing edx and openedx brand scope

* refactor: support process.env.PARAGON_THEME_URLS

* fix: make PARAGON_THEME_URLS be defined only as env

---------

Co-authored-by: Adam Stankiewicz <agstanki@gmail.com>
Co-authored-by: Peter Kulko <93188219+PKulkoRaccoonGang@users.noreply.github.com>
…k> styles once loaded, example app updates to show ParagonWebpackPlugin output

* Adds back `sassOptions.quietDeps: true`, as it was removed in a previous release (14.1.0) triggering disruptive Sass deprecation warnings.
* Updates `ParagonWebpackPlugin` to apply injected <link> styles once loaded.
* Updates example app to show a preview of the `ParagonWebpackPlugin`'s output.
This matches the shape of our authenticatedUser object.
The testing app used to be modeled after an MFE; now it’s a project and properly compatible with frontend-base.  Renaming it for clarity.
… test-project

This is step one, and ensures we preserve commit history.
…Props` via `slotOptions.mergeProps` (#84)

* feat: support merging props with PluginOperations.Modify

* fix: provide default content object for widget modification

* chore: pr feedback

* chore: consolidate examples

* chore: remove content prop from LinkExample

* chore: pr feedback, updating comment
This is for new pages in the test project.  This also removes “react” as an explicit import where it’s no longer necessary.
Two changes together:

- Adding the test pages from the frontend-plugin-framework example app into the test-project.
- Converting the DIRECT_PLUGIN, IFRAME_PLUGIN, and PLUGIN_OPERATIONS constants into types.  This is necessary so that we can get the pluginSlots data structure into the SiteConfig typescript interface for use in the test project.
This is the example app from frontend-plugin-framework, which is no longer needed.  It’s contents have been folded into test-project.
Also ceasing to use forwardRef in favor of just manually passing the ref through.  This is considered a simpler and more flexible alternative to forwardRef (and is a bit more readable, IMO)
Upgrades `@edx/eslint-config` to pull in updates ESLint rules for consuming MFEs.
Not sure how I missed this, but everything explodes if you remove it.
The ProjectSiteConfig type now reflects that some types are optional in a config document, whereas SiteConfig requires values for everything, some of which may be defaulted.
We actuall use parameter reassignment in the plugin framework intentionally.
In general we’re moving away from redux as per this ADR on OEP-67: https://open-edx-proposals.readthedocs.io/en/latest/best-practices/oep-0067/decisions/frontend/0010-react-query.html

Because of this, the shell will cease to provide a redux provider.  If modules want redux, they can provide it via their own provider.
This is in preparation for extracting the React components out into a file called “Shell.tsx”
This was necessary to add type information for the Shell.
The component is aware of which header is requested by the active module, and switches accordingly.
…ing!

This lets the shell load federated modules and then use the “fog of war” API in react-router to add their routes to the router on demand.  It works!
# Conflicts:
#	.npmignore
#	README.md
#	catalog-info.yaml
#	config/.eslintrc.js
#	config/jest.config.js
#	config/jest/setupTest.js
#	config/webpack.common.config.js
#	config/webpack.dev-stage.config.js
#	example/package-lock.json
#	example/package.json
#	example/src/App.jsx
#	example/src/__snapshots__/App.test.jsx.snap
#	example/src/apple.jpg
#	package-lock.json
#	package.json
#	test-project/src/ParagonPreview.jsx
#	tools/webpack/webpack.build.config.ts
#	tools/webpack/webpack.dev.config.ts
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Sep 13, 2024
@openedx-webhooks
Copy link

Thanks for the pull request, @davidjoy!

What's next?

Please work through the following steps to get your changes ready for engineering review:

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.

🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads

🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

🔘 Let us know that your PR is ready for review:

Who will review my changes?

This repository is currently maintained by @openedx/axim-engineering. Tag them in a comment and let them know that your changes are ready for review.

Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

davidjoy and others added 13 commits September 13, 2024 11:36
There were a lot of problems here.  I found a number of what appear to be bugs in the code, and the data structures aren’t well-documented enough for me to tell what’s an error vs. expected behavior.

I attempted to make some TypeScript types for the data structures, but had to give up.  I ended up annotating many variables with the `any` type, and also had to add // @ts-ignore comments in a number of places to get the build to work.
fix: roughly turning files into TypeScript
# Conflicts:
#	README.rst
#	example/package.json
#	package-lock.json
#	package.json
#	runtime/plugins/PluginContainer.jsx
#	runtime/plugins/PluginSlot.test.jsx
#	runtime/plugins/PluginSlot.tsx
#	runtime/plugins/data/utils.test.jsx
#	test-project/package-lock.json
#	test-project/site.config.dev.tsx
#	test-project/src/PluginPage.jsx
#	test-project/src/pluginSlots/PluginSlotWithModifyDefaultContents.jsx
#	test-project/src/pluginSlots/PluginSlotWithModifyWrapHide.jsx
Fixing some errors from the FPF merge.
Somehow this got missed in the merge of frontend-platform, I think because I didn’t manually merge the package.json file.
@davidjoy davidjoy merged commit 6d0ae1c into openedx:main Sep 13, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

7 participants